#import "PrivatePhotosLogic.h"
@implementation PrivatePhotosLogic
- (instancetype)init
{
    self = [super init];
    if (self) {
        _page = 0;
        _dataArray = [NSMutableArray array];
    }
    return self;
}
-(void)loadData
{
    if (_page == 0) {
        [_dataArray removeAllObjects];
    }
    NSString *url = [[CYURLUtils sharedCYURLUtils] makeURLWithC:@"private_photo_api" A:@"pictures_list"];
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    [param setObject:@(_page) forKey:@"page"];
    [param setObject:self.touid forKey:@"id"];
    if(!StrValid(self.type))
    {
        self.type = @"";
    }
    [param setObject:self.type forKey:@"type"];
    [CYNET POSTv2:url parameters:param responseCache:^(id responseObject) {
    } success:^(id responseObject) {
        if (_page == 0) {
            [_dataArray removeAllObjects];
        }
        NSArray *list = [NSArray modelArrayWithClass:[PrivatePhotosModel class] json:[responseObject valueForKey:@"list"]];
        [_dataArray addObjectsFromArray:list];
        if (self.delegagte && [self.delegagte respondsToSelector:@selector(requestDataCompleted)]) {
            [self.delegagte requestDataCompleted];
        }
    } failure:^(NSString *error) {
        [[HUDHelper sharedInstance] tipMessage:error];
        if (self.delegagte && [self.delegagte respondsToSelector:@selector(requestDataCompleted)]) {
            [self.delegagte requestDataCompleted];
        }
    } hasCache:YES];
}
@end
